home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bluep.swf / scripts / frame_1 / DoAction_2.as next >
Text File  |  2013-04-24  |  4KB  |  136 lines

  1. function setup()
  2. {
  3.    myFlag = 0;
  4.    Counter = -1;
  5.    totalFileSize = _root.getBytesTotal();
  6.    startBytes = _root.getBytesLoaded();
  7.    tickerStartLocationX = _root.theTicker._x;
  8.    tickerStartLocationY = _root.theTicker._y;
  9.    _global.up = 87;
  10.    _global.down = 83;
  11.    _global.rightward = 68;
  12.    _global.leftward = 65;
  13.    _global.jump = 32;
  14.    _global.hotKey_up = _global.up;
  15.    _global.hotKey_down = _global.down;
  16.    _global.hotKey_left = _global.leftward;
  17.    _global.hotKey_right = _global.rightward;
  18.    _global.hotKey_jump = _global.jump;
  19.    _root.crosshair.cacheAsBitmap = true;
  20.    Mouse.hide();
  21.    _global.FPSforTweenClass = 45;
  22.    _global.trailOn = true;
  23.    _global.soundOn = true;
  24.    _global.musicOn = true;
  25.    _global.myMusicPlayer = new Music();
  26.    _global.SoundManager = new SoundPlayer();
  27. }
  28. function run()
  29. {
  30.    mouseCurserAdjust();
  31.    preloaderStuff();
  32.    rotateAvatar();
  33. }
  34. function preloaderStuff()
  35. {
  36.    if(Counter == -1)
  37.    {
  38.       bytesLoaded = _root.getBytesLoaded();
  39.       amountLoaded = bytesLoaded / totalFileSize;
  40.       myPercentLoaded = int(100 * amountLoaded);
  41.       _root.preload_txt.text = myPercentLoaded + "%";
  42.       tickerX = tickerStartLocationX + myPercentLoaded * 2;
  43.       moveTicker(_root.theTicker,tickerX,tickerStartLocationY);
  44.       if(amountLoaded >= 1 && myFlag == 0)
  45.       {
  46.          myFlag = 1;
  47.          Counter = 30;
  48.          if(_global.latestLevel != 0)
  49.          {
  50.             Counter = 0;
  51.          }
  52.       }
  53.    }
  54.    else if(Counter == 0)
  55.    {
  56.       okToPlay = true;
  57.       siteURL = "http://www.herointeractive.com";
  58.       siteURL2 = "http://herointeractive.com";
  59.       if(_url.substr(0,siteURL.length) == siteURL || _url.substr(0,siteURL2.length) == siteURL2)
  60.       {
  61.          okToPlay = true;
  62.       }
  63.       if(okToPlay)
  64.       {
  65.          if(_global.latestLevel == 0)
  66.          {
  67.             _root.gotoAndPlay("loadSounds");
  68.          }
  69.          else
  70.          {
  71.             _root.gotoAndPlay("loadSounds");
  72.          }
  73.       }
  74.    }
  75.    else
  76.    {
  77.       Counter--;
  78.    }
  79. }
  80. function moveTicker(mc, xVal, yVal)
  81. {
  82.    var _loc5_ = xVal;
  83.    var _loc6_ = yVal;
  84.    var _loc3_ = 0.00009;
  85.    var _loc4_ = _global.FPSforTweenClass;
  86.    var _loc7_ = mc._x;
  87.    var _loc8_ = mc._y;
  88.    myTweening = new mx.transitions.Tween(mc,"_x",mx.transitions.easing.Strong.easeOut,_loc7_,_loc5_,_loc3_,true);
  89.    myTweening = new mx.transitions.Tween(mc,"_y",mx.transitions.easing.Strong.easeOut,_loc8_,_loc6_,_loc3_,true);
  90.    myTweening.FPS = _loc4_;
  91.    myTweening.FPS = _loc4_;
  92.    myTweening.onMotionFinished = function()
  93.    {
  94.    };
  95. }
  96. function rotateAvatar()
  97. {
  98.    var _loc2_ = new Vector();
  99.    _loc2_._x = _xmouse - _root.pointer._x;
  100.    _loc2_._y = _ymouse - _root.pointer._y;
  101.    var _loc3_ = Math.atan2(_loc2_._y,_loc2_._x);
  102.    var _loc4_ = 360 * _loc3_ / 6.283185307179586;
  103.    _root.pointer._rotation = _loc4_;
  104. }
  105. function mouseCurserAdjust()
  106. {
  107.    _root.crosshair._x = _xmouse;
  108.    _root.crosshair._y = _ymouse;
  109. }
  110. function OpenArmorGames()
  111. {
  112.    getUrl("http://www.armorgames.com", "_blank");
  113. }
  114. function OpenHeroInteractive()
  115. {
  116.    getUrl("http://www.herointeractive.com", "_blank");
  117. }
  118. stop();
  119. _root.kongregateServices.connect();
  120. var myFlag;
  121. var Counter;
  122. var totalFileSize;
  123. var startBytes;
  124. var tickerStartLocationX;
  125. var tickerStartLocationY;
  126. var tickerX;
  127. _global.dataVector = new DataObject();
  128. _global.dataVector.mSet(9282);
  129. var additionalMenu = new ContextMenu();
  130. additionalMenu.hideBuiltInItems();
  131. var NewItem = new ContextMenuItem("Play More Games!",OpenArmorGames);
  132. additionalMenu.customItems.push(NewItem);
  133. NewItem = new ContextMenuItem("This Game Developed by Hero Interactive",OpenHeroInteractive);
  134. additionalMenu.customItems.push(NewItem);
  135. _root.menu = additionalMenu;
  136.